package com.ruoyi.product.service.impl;

import java.util.List;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.product.mapper.TbBrandMapper;
import com.ruoyi.product.domain.TbBrand;
import com.ruoyi.product.service.ITbBrandService;

/**
 * 品牌列表Service业务层处理
 *
 * @author ruoyi
 * @date 2025-08-05
 */
@Service
public class TbBrandServiceImpl implements ITbBrandService {
    @Autowired
    private TbBrandMapper tbBrandMapper;

    /**
     * 查询品牌列表
     *
     * @param brandId 品牌列表主键
     * @return 品牌列表
     */
    @Override
    public TbBrand selectTbBrandByBrandId(Integer brandId) {
        return tbBrandMapper.selectTbBrandByBrandId(brandId);
    }

    /**
     * 查询品牌列表列表
     *
     * @param tbBrand 品牌列表
     * @return 品牌列表
     */
    @Override
    public List<TbBrand> selectTbBrandList(TbBrand tbBrand) {
        return tbBrandMapper.selectTbBrandList(tbBrand);
    }

    /**
     * 新增品牌列表
     *
     * @param tbBrand 品牌列表
     * @return 结果
     */
    @Override
    public int insertTbBrand(TbBrand tbBrand) {
        tbBrand.setCreateTime(DateUtils.getNowDate());
        return tbBrandMapper.insertTbBrand(tbBrand);
    }

    /**
     * 修改品牌列表
     *
     * @param tbBrand 品牌列表
     * @return 结果
     */
    @Override
    public int updateTbBrand(TbBrand tbBrand) {
        tbBrand.setUpdateTime(DateUtils.getNowDate());
        return tbBrandMapper.updateTbBrand(tbBrand);
    }

    /**
     * 批量删除品牌列表
     *
     * @param brandIds 需要删除的品牌列表主键
     * @return 结果
     */
    @Override
    public int deleteTbBrandByBrandIds(Integer[] brandIds) {
        return tbBrandMapper.deleteTbBrandByBrandIds(brandIds);
    }

    /**
     * 删除品牌列表信息
     *
     * @param brandId 品牌列表主键
     * @return 结果
     */
    @Override
    public int deleteTbBrandByBrandId(Integer brandId) {
        return tbBrandMapper.deleteTbBrandByBrandId(brandId);
    }

    @Override
    public AjaxResult getBrandList() {
        List<TbBrand> brandList = tbBrandMapper.selectTbBrandList(null);
        return AjaxResult.success(brandList);
    }
}
